package com.adaxi.adc.business.vehicletrip.controller;

import com.adaxi.adc.business.vehicletrip.pojo.RoutePrice;
import com.adaxi.adc.business.vehicletrip.service.RoutePriceService;
import com.adaxi.adc.common.common.CommonResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 路线价格控制器
 */
@RestController
public class RoutePriceController {
    final RoutePriceService routePriceService;

    public RoutePriceController(RoutePriceService routePriceService) {
        this.routePriceService = routePriceService;
    }

    @GetMapping("/routePrice/{id}")
    public CommonResult<RoutePrice> routePrice(@PathVariable String id) {
        RoutePrice routePrice = routePriceService.getById(id);
        return CommonResult.SUCCESS("查询成功", routePrice);
    }

    @GetMapping("/routePriceAll")
    public CommonResult<List<RoutePrice>> findAllRoutePrices() {
        List<RoutePrice> routePrices = routePriceService.list();
        return CommonResult.SUCCESS("查询成功", routePrices);
    }
}
